package com.foreknow.test_Exception;

public class ExceptionDemo03 {
    public int add(int a, int b) throws Exception {
        if (a < 0 || b < 0) {
            Exception e = new Exception();
            throw e;
        }
        return a + b;
    }

    public static void main(String[] args) {
        ExceptionDemo03 demo03 = new ExceptionDemo03();
        try {
            demo03.add(-1,-1);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
